#!/bin/sh
# This shell script used to cross compile dropbear for fl2440
# Before excute this shell script, please download the source code to here first.
# Download Address: http://matt.ucc.asn.au/dropbear/releases/dropbear-0.52.tar.bz2

APP_NAME=dropbear-0.52
PATCH_FILE=./patch/build.sh
PACK_SUFFIX=tar.bz2


if [ ! -d ${APP_NAME} ] ; then
   if [ -f ${APP_NAME}.${PACK_SUFFIX} -a -f $PATCH_FILE ] ; then
        echo "==================================================="
        echo "+           Decompress $APP_NAME now...            "
        echo "==================================================="
        rm -rf ${APP_NAME}
        tar -xjf ${APP_NAME}.${PACK_SUFFIX}
        
        echo "===================================================" 
        echo "+                 Patching now...                  " 
        echo "===================================================" 
        cp -rf ${PATCH_FILE} ${APP_NAME}
  else 
          echo "================================================================" 
          echo "+       ERROR: Missing $APP_NAME Source Code Packet!              " 
          echo "+ Plese download ${APP_NAME}.${PACK_SUFFIX} to here and try again! " 
          echo "+ Download: http://matt.ucc.asn.au/dropbear/releases/dropbear-0.52.tar.bz2 " 
          echo "================================================================" 
          exit; 
  fi 
fi

cd $APP_NAME && sh build.sh

